<%@taglib prefix="s" uri="/struts-tags"%>
 
<s:form action="saveFactorVac" id="FactorVacForm" theme="simple">
	<s:hidden name="factorVac.dia" />
	<s:hidden name="factorVac.mes" />
	<s:hidden name="factorVac.anio" />
	<s:hidden name="diaAntiguo" />
	<s:hidden name="mesAntiguo" />
	<s:hidden name="anioAntiguo" />
	<s:hidden name="dia" />
	<s:hidden name="mes" />
	<s:hidden name="anio" />
	<s:hidden name="fecha" />
	<table width="100%">
		<tr>
			<td>
			<table width="100%">
				<tr>
					<td>
					<div id="pageTitle">Factor VAC</div>
					</td>
				</tr>
				<tr>
					<td>
					<div class="formpanel">
					<table cellspacing="0" width="100%">
						<tr>
							<td class="label">Fecha:</td>
							<td><s:textfield theme="simple" name="factorVac.fecha"
								id="txtFecha" maxlength="10" size="15" onchange="valFecha();"
								cssClass="validate[required]" readonly="true"/>
							</td>
						</tr>
						<tr>
							<td class="label">Valor VAC:</td>
							<td><s:textfield theme="simple" name="factorVac.cadValorVAC"
								id="txtValorVAC" maxlength="11" size="11" 
								cssClass="validate[required]" 
								onkeypress="return CatchNonNumbers_(event,1,1,'.',this,6,4,this);"/>
							</td>
						</tr>
					</table>
					</div>
					</td>
				</tr>
			</table>
			<table>
				<tr>
					<td><s:submit theme="simple" value="Guardar" id="btnGuardar"
						cssClass="ui-button ui-widget ui-state-default ui-corner-all"></s:submit>&nbsp;
					<input type="button" value="Limpiar" id="btnLimpiar"
						class="ui-button ui-widget ui-state-default ui-corner-all" />&nbsp;
					<input type="button" value="Retornar" id="btnRetornar"
						onclick="retornar()"
						class="ui-button ui-widget ui-state-default ui-corner-all" /></td>
				</tr>
			</table>
			</td>
		</tr>
	</table>
</s:form>
<script language="JavaScript" type="text/javascript">	
	$(document).ready(function(){
		$("#FactorVacForm").validationEngine();
		$("#btnLimpiar").click(function(){
			limpiarForm();
		});
    	if($("input[name=diaAntiguo]").val()!=''){
			$("#txtFecha").attr('disabled',true);
		}else{
			$( "#txtFecha" ).datepicker({ 
	    							dateFormat: 'dd/mm/yy',
	    							maxDate: "+0D",
	    							showOn: "button",
								    buttonImage: "images/calendar.gif",
									buttonImageOnly: true });
	    	$( "#txtFecha" ).datepicker();
			$("#txtFecha").attr('disabled',false);
		}
	});
	
	function limpiarForm(){
		$("#txtFecha").val("");
		$("#txtValorVAC").val("");
	}
	
	function valFecha(){
		
		if($("#txtFecha").val()!=''){
			$("#txtFecha").removeClass("validate[required]").validationEngine('hide');
		}else{
			$("#txtFecha").addClass("validate[required]");
		}
	}
		
	function retornar(){
		$("#formAux").attr("action","./initFactorVac.do");
		$("#formAux").submit();
	}  
</script>
